
<!--创建图文--> 

<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/baseui/css/amazeui.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/baseui/css/admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/css/style.css"/>




<!--[if (gte IE 9)|!(IE)]><!-->
	<script type="text/javascript" src="//cdn.bootcss.com/jquery/2.2.2/jquery.min.js"></script>
	<script type="text/javascript" src="//cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
  	<script>$(function() {FastClick.attach(document.body);});</script>
<!--<![endif]-->

<!--[if lte IE 8 ]>
	<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
	<script type="text/javascript" src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
	<script type="text/javascript" src="__STATIC__/weixin/assets/sell/baseui/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<script type="text/javascript" src="//cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>





<link href="__STATIC__/weixin/umeditor/themes/default/css/umeditor.css?001" type="text/css" rel="stylesheet">


<script type="text/javascript" src="__STATIC__/weixin/assets/sell/js/jquery.form.js"></script>

<script type="text/javascript" charset="utf-8" src="__STATIC__/weixin/umeditor/umeditor.config.js"></script>

<script type="text/javascript" charset="utf-8" src="__STATIC__/weixin/umeditor/umeditor.js?001"></script>

<style>

  .create_news_box{

    font-weight: 400;

    font-size:14px;

    padding:10px 15px 0;

  }

  .add_news{

   width: 255px;

   height:auto;

   margin:10px 15px 0;

  }

  .news_first{

    width: 255px;

    height: 180px;

    border:1px solid #e7e7eb;

    background-color:#fff; 

    cursor: pointer;

  }

  .cover_item{

    height:35px;

    background-color: #000;

    opacity: 0.5;

    position: absolute;

    left:0;

    right:0;

    bottom: 0 !important;

    z-index: 1;

    display:block;

    padding: 8px 0 0 223px;

  }

  .del_icon{

    background: url(__STATIC__/weixin/assets/sell/images/base_z2b638f.png) 0 -4827px no-repeat ;

    width: 18px;

    height: 18px;

    line-height:18px;

    display: inline-block;

    overflow: hidden;

  }

  .news_title{

    position: absolute;

    left:0;

    right:0;

    bottom: 0;

    background-color: #000;

    opacity: 0.6;

    margin:0;

    border: 1px solid #ccc;

  }

  .news_next_title a,.news_title a{

    margin-left:10px;

    display:inline-block;

    word-wrap: break-word;

    word-break: break-all;

  }

.news_next_title a{

  color:#222;

}

.news_title a{

  color:#fff;

}

  .news_content{

    background-repeat:no-repeat;

    background-size:cover;

    margin:9px auto;

    width: 225px;

    height: 160px;

    position:relative;

  }

  .img_icon{

    background:url(__STATIC__/weixin/assets/sell/images/media_z2ac3d8.png) 0 -100px no-repeat;

    width: 44px;

    height: 34px;

    vertical-align: middle;

    display: inline-block;

    overflow: hidden;

  }

  .add_next{

    width: 255px;

    height: 96px;

    border:2px dotted #e7e7eb;

    cursor: pointer;

    border-top-width: 0;

  }

  .add_icon{

    width: 35px;

    height: 35px;

    vertical-align: middle;

    display: inline-block;

    background: url(__STATIC__/weixin/assets/sell/images/base_z2b638f.png) 0 -2915px no-repeat;

    margin: 30.5px 105px;

  }

  .add_new_next{

    width: 255px;

    height: 8rem;

    border:1px solid #e7e7eb;

    cursor: pointer;

    border-top-width: 0;

    background-color:#fff; 

  }

  .add_new_next .news_content{

    height:100%;

    margin:0;

    padding:9px 14px;

    background-color:#fff;

    width:253px;

  }

  .add_new_next .news_next_title{

    display:inline-block;

    width:122px;

  }

  .news_title,.news_next_title{

    margin:0;

  }

  .add_new_next .news_image{

    display:inline-block;

    float:right;

    width:103px;

    height:78px;

  }

  .news_first .news_image{

    width:100%;

    height:100%;

    line-height: 140px;

    text-align: center;

  }

  .news_image{

    background-color:#ececec;

    background-position: cover;

    background-repeat: no-repeat;

    background-size:cover;

  }

  

  .next_news_content{

    border: 1px solid #ccc;

    background-color: #ececec;

    width: 42%;

    height: 6.5rem;

    float: right;

    margin:8px 10px;

    

  }

  .next_img_icon{

    background:url(__STATIC__/weixin/assets/sell/images/media_z2ac3d8.png) 0 -144px no-repeat;

    width: 32px;

    height: 24px;

    vertical-align: middle;

    display: inline-block;

    line-height: 300px;

    overflow: hidden;

    margin:27px 35.5px;

  }

  .news_del{

    position: relative;

  }

  .news_del.selected{

    border:1px solid green;

  }

  .ceatnews_body_right{

    height:100%;

    float:left;

    width: auto;

    margin-left:35px;



    

  }

  .ceatnews_body_right .input_title{

    width: 313px;



  }

  .ceatnews_body_right .input_author{



    width: 250px;



    

  }

  .text_content{

    width: 600px;

    height:450px;

  }

  .edit_link{

    margin-top:10px;

  }

   .text_link{

    display:none;

    width:300px;

  }

  .edit_link .select_link{

    margin-left: 10px;

  }



 #editor #edui1 #edui1_iframeholder{

    max-height: 155px;

    overflow: auto;

 }

 .style_edit{



 }

 .style_edit_title{

    font-size: 14px;

 }

 .image_suggest{

    margin-left:5px;

    color:#8d8d8d;

    font-size: 14px;

 }

 .front_cover_text{

    font-size: 14px;

 }

 .am-modal-dialog .modal-hd-top{

    background-color:#f4f5f9;

    line-height: 20px;

      height: 52px; 

  }

  .am-modal .am-modal-dialog {

    background: #fff;

  }

  .image_table{

    width:90%;

    height:85%;

    border:1px solid #ccc;

    margin:10px auto;

    

  }

  .news_table{

    width:90%;

    height:660px;

    border:1px solid #ccc;

    margin:10px auto;

  }

  .file_local{

    height:45px;

    margin-top:7px;

    margin-bottom: 10px;

    border-bottom:1px solid #ccc;

  }

  .image_list{

    width: 100%;

    height:90%;

    overflow: auto;

  }

  .show_image{

    margin-left:22px;

    margin-bottom: 32px;

    float:left;

    width:118px;

    height:118px;

    position: relative;

    cursor: pointer;

  }

  .selected_mask {

      position: absolute;

      width: 100%;

      height: 100%;

      top: 0;

      left: 0;

      display: none;

  }

  .selected_mask_inner {

      width: 118px;

      height: 118px;

      -moz-opacity: .6;

      -khtml-opacity: .6;

      opacity: 0.6;

      background-color: #000;

  }

  .selected_mask_icon {

      position: absolute;

      top: 0;

      left: 0;

      background: transparent url(__STATIC__/weixin/assets/sell/images/selected_mask_icon.png) no-repeat 0 0;

      width: 118px;

      height: 118px;

      vertical-align: middle;

      display: inline-block;

      background-position: 50% 50%;

  }

  .show_image img{

    width:118px;

    height:118px;

    border:1px solid #ccc;



  }

  .clear{

    clear:both;

  }

  .del_image{

    display:none;

    margin-left: 10px;

  }

  .get_image{

    width:100px;

    height:100px;

    border: 1px solid #ccc;

    margin-top: 10px;

    margin-left: 10px;

  }

  .news_first .cover_item .del_icon{

    display:none;

  }

  label{

    font-weight:400;

  }

</style>

<body>

 

<div class="am-cf admin-main">



<!-- comfirm -->

<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">

  <div class="am-modal-dialog">

    <div class="am-modal-hd"></div>

    <div class="am-modal-bd" id="del_alert">确认删除该篇图文

    </div>

    <div class="am-modal-footer">

      <span class="am-modal-btn" data-am-modal-confirm>确定</span>

      <span class="am-modal-btn" data-am-modal-cancel>取消</span>

      

    </div>

  </div>

</div>

<!-- comfirm end -->

<style>

  .table td{

    vertical-align: top;

    text-align:centent;

  }

  .newsLeft{

    background-color:#f8f8f8;

    border-right:1px solid #e7e7eb;

    border-left:1px solid #e7e7eb;

  }

  .newsRight{

    padding-left:20px;

  }

  .cover{

    margin-bottom:400px;

  }

  .linkTips{

    display:none;

    margin:0;

    font-size:14px;

    color:#e15f63;

  }

</style>
<!-- content start -->

<div class="admin-content">

	<div class="admin-content-body">

    

      <div class="am-margin-top-sm am-margin-left">

  		  <strong class="am-text-primary am-text-lg">新建图文</strong> /

  		  <small>Creat news</small>

      </div>

        <div class="am-margin" style="border-top:1px solid #e7e7eb;">

          <table class="table">

            <tr>

              <td class="newsLeft">

                <div class="cover">

                <h4 class="create_news_box">图文列表</h4>

                <div class="add_news">

                  <div class="news_first news_del selected" title="第一篇图文" id="news_1">

                    <div class="cover_item" style="display:none;">

                      <i class="del_icon"></i>

                    </div>

                    <div class="news_content js_newsContent">

                      <div class="news_image"><i class="img_icon js_imgIcon"></i></div>

                      <h4 class="news_title js_newsTitle"><a href="javascript:void(0);">标题</a></h4>

                    </div>

                  </div>

                  <div class="add_next" title="添加一篇图文">

                    <i class="add_icon"></i>

                  </div>

                </div>

              </div>

            </td>

            <td class="newsRight">

              <div class="">

              <div class="am-padding am-padding-bottom-0" style="padding:0.6rem">

                <div class="am-fl am-cf">

                  <strong class="am-text-primary am-text-lg">图文内容编辑</strong> /

                  <small>Edit content</small>

                </div>

              </div>

              <hr>

              <div class="form_input">

                <input type="text" id="doc-vld-name" minlength="3" placeholder="请输入标题" class="am-form-field input_title" required style="width:415px;float:left;" />

                <input type="text" minlength="3" placeholder="请输入作者" class="am-form-field input_author" required style="width:210px;float:left;margin-left:50px;" />

                <div class="clear"></div>

                <hr>

                <div class="input-group">

                  <script type="text/plain" id="myEditor" style="width:675px;height:240px;margin-bottom:20px;" class="item_content"></script>

                </div>

                <script>

                  var um = UM.getEditor('myEditor',{

                    toolbar:['source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',

                      'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,

                      '| justifyleft justifycenter justifyright justifyjustify |',

                      'link unlink | emotion imageinsert ',

                      '| horizontal preview', 'drafts', 'formula']

                  });

                </script>

              </div>

              <div class="clear"></div>

              <hr style="margin-bottom:0px;" />

              <div class="edit_link">

                <!-- <button type="button" class="image_model am-btn am-btn-success imagetest" data-isinsert="yes" data-am-modal="{target: '#doc-modal-image', closeViaDimmer: 0, width: 800, height:800}">正文图片选择</button> -->

                <label class="am-checkbox">

                    <input type="checkbox" name="url" value="" data-am-ucheck class="select_link"/>原文链接

                </label>

                <input type="text" class="am-form-field am-radius text_link" placeholder="" name="text_link" />

                <p class="linkTips">链接不合法</p>

              </div>

              <hr style="margin-bottom:0px;" />

              <div class="style_edit">

                <!---->

                <div class="front_cover">

                  <label for=""><span class="front_cover_text">封面</span><span class="image_suggest">大图片建议尺寸：900像素 * 500像素</span></label>

                  <div class="button_uplod">

                    <button type="button" class="am-btn am-btn-secondary imageUpload">本地上传</button>

                    <button type="button" class="am-btn am-btn-secondary select_image image_model" data-am-modal="{target: '#doc-modal-image', closeViaDimmer: 0, width: 800, height:800}" style="" >从图库中选择</button>

                    <label class="am-checkbox">

                      <input type="checkbox" name="cover" value="" data-am-ucheck  class="show_cover_pic" />封面图片显示在正文中

                    </label>

                    <form method="post" enctype="multipart/form-data" action="index.php?m=Admin&c=Weixin&a=localimage" id="imageForm" style="display:none;">

                      <input type="file" name="upload_image" id="media_image" />

                    </form>

                  </div>

                  <style type="text/css">

                    .hide_image{

                      position:relative;

                      display:none;

                      width:150px;

                    }

                    .uploadTs{

                      line-height:150px;

                      text-align: center;

                    }

                    .get_image_show{

                      display:none;

                      width:100%;

                      height:150px;

                    }

                    .news_del_image{

                      position:absolute;

                      left:0;

                      right:0;

                      bottom:0;

                      display:none;

                      height:30px;

                      line-height:30px;

                      background-color:#000;

                      opacity:0.5;

                      z-index:1;

                      text-align:center;

                    }

                    .news_del_image a{

                      display:block;

                    }

                  </style>

                  <div class="hide_image">

                    <div class="uploadTs"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 上传中</div>

                    <img src="" class="get_image_show" />

                    <!-- <a href="javascript: void(0)" class="del_image">删除</a> -->

                    <div class="news_del_image">

                      <a href="javascript:void(0);">

                         <i class="del_icon" style="margin-top:6px"></i>

                      </a>

                    </div>

                  </div>

                  <hr style="margin-bottom:0px;" />

                  <div class="front_cover">

                    <label for=""><span class="front_cover_text">摘要</span><span class="image_suggest">选填，如果不填写会默认抓取正文前54个字</span></label>

                    <div class="am-form-group">

                      <textarea class="summary" rows="5" style="width:675px;"></textarea>

                    </div>

                  </div>

                  <div class="am-margin am-submit" style="margin-left:0px;">

                    <button type="button" class="am-btn am-btn-secondary" id="uploadNews">提交保存</button>

                    </div>

                  </div>

                </div>

              </div>

            </div>

            </td>

            </tr>

          </table>

          

      <footer class="admin-content-footer">
	<hr>
	<p class="am-padding-left">爱淘客</p>
</footer>

    </div>

  </div>

</div>



<!-- content end -->

<!-- alert -->

<div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">

  <div class="am-modal-dialog">

    <div class="am-modal-hd" id="fq_alert_title"></div>

    <div class="am-modal-bd" id="fq_alert_info">

    </div>

    <div class="am-modal-footer">

      <span class="am-modal-btn">确定</span>

    </div>

  </div>

</div>

<!-- alert end -->



<style>

  .popover{

    width:290px;

    position: absolute;

    z-index: 999;

    

  }

  .news_del{

    position: relative;

    z-index: 1;

  }

</style>

<script type="text/javascript">

        news = {};

        news['news_1'] = {};

        news['news_1']['show_cover_pic'] = 0;

          $(function(){

            //添加图文

            $('.add_next').on('click',function(){



              var times = new Date().getTime();

              var id = times+'_news';

			  

              $('.add_next').before('<div class="add_new_next news_del" id="'+id+'"><div class="cover_item"><i class="del_icon"></i></div><div class="news_content js_newsContent"><div class="news_image"><i class="img_icon js_imgIcon next_img_icon"></i></div><h4 class="js_newsTitle news_next_title"><a href="javascript:void(0);">标题</a></h4></div></div>');

            

              news[id] = {};

              news[id]['show_cover_pic'] = 0;

              

              //清空页面

              $('.input_title').val('');

              $('.input_author').val('');

              $('.item_content').html('');

              $('.hide_image,.get_image_show,.del_image').hide();

              $('.news_del').removeClass('selected');

              $('#'+id).addClass('selected');

              $('.show_cover_pic').prop('checked',false);

              $('.select_link').prop('checked',false);

              $('.text_link').hide();

              $('.text_link').val('');

			        $('.summary').val('');

              //根据图文数量显隐添加按钮

                var newsLength = $('.news_del').length;

                if(newsLength == 8){

                  $('.add_next').hide();

                }

            });



              //删除图文

              $('.add_news').on('click','.del_icon',function(){

                var id = $(this).parent('.cover_item').parent('.news_del').attr('id');

                $('#my-confirm').modal({

                  relatedTarget:this,

                  onConfirm:function(options){

                    $('.news_del').removeClass('selected');

                    $(this.relatedTarget).parent('.cover_item').parent('.news_del').remove();

                    //少于8篇 显示添加按钮

                    if($('.news_del').val()<8){

                      $('.add_next').show();

                    }



                    news[id] = '';

                    //清空内容

                    $('.input_title,.text_link,.input_author,.summary').val('');

                    $('.item_content').html('');

                    $('.select_link,.show_cover_pic').prop('checked',false);

                    $('.text_link,.hide_image,.get_image_show,.del_image').hide();

                    $('.get_image_show').attr('src','');



                  }

                })

              });



              //鼠标特效

             $('.add_news').on('mouseover','.news_del',function(){

                $(this).children('.cover_item').show();

              });

              $('.add_news').on('mouseout','.news_del',function(){

                $(this).children('.cover_item').hide();

              });



              //选填文章原地址

              $('.select_link').click(function(){

                var id = $('.selected').attr('id');

                if($('.select_link').prop('checked') == true){

                 

                  $('.text_link').show();

                }else{

                  

                  $('.text_link').hide();

                }

              });



              //获取原文地址

              $('.text_link').blur(function(){

                  var id = $('.selected').attr('id');

                  var url = $.trim($(this).val());

                  if(url != ''){

                    var check = url.match(/^((ftp):\/\/)/);

                    if(check == null){

                      $('.linkTips').hide();

                      if(id != undefined && id != ''){

                        news[id]['url'] = url;

                      }else{

                        

                        return false;

                      }

                    }else{

                      $('.linkTips').show();

                      return false;

                    }

                  }  

              });



              //获取标题

              $('.input_title').blur(function(){

                var id = $('.selected').attr('id');

                if(id != undefined && id != ''){

                  news[id]['title'] = $(this).val();

                  $('#'+id+' .js_newsContent .js_newsTitle a').html($(this).val());

                }

              });



              //获取作者

              $('.input_author').blur(function(){

                var id = $('.selected').attr('id');

                if(id != undefined && id != ''){

                  news[id]['author'] = $(this).val();

                }

              });



              //获取内容

              $(document).keyup(function(){

                var id = $('.selected').attr('id');

                var content = um.getContent();

                news[id]['content'] = content;

              });

              $(document).mousedown(function(){

                var id = $('.selected').attr('id');

                var content = um.getContent();

                news[id]['content'] = content;

              });





              //上传图片

              $('.imageUpload').click(function(){

                var id = $('.selected').attr('id');

                if(id != undefined && id != ''){

                  $('#media_image').click();

                }

              });



              $('#media_image').change(function(){

                $('.hide_image,.uploadTs').show();

                $('.get_image_show').attr('src','');

                $('#imageForm').ajaxSubmit({

                  dataType:'json',

                  success:function(data){

                    $('.uploadTs').hide();

                    var id = $('.selected').attr('id');

                    news[id]['thumb_url'] = data.image_url;

                    news[id]['thumb_media_id'] = data.media_id;

                    $('.get_image_show').show();

                    $('.get_image_show').attr('src',data.image_url);

                    $('#'+id).find('.news_image').css({'background-image':'url('+'{$TencentPicturePre}'+data.image_url+')'});

                    $('#'+id).find('.img_icon').hide();

                    $('.del_image').show();

                    $('#media_image').replaceWith($('#media_image').clone(true));

                  }

                });

              });

			  

			  //从素材库选择图片

			  $('.select_image').click(function(){

				 $('#edit_image').attr('data-edit',"select_image");

			  });

			  

              //选择图片

              $('#edit_image').click(function(){

			          if($('#edit_image').attr('data-edit')=="select_image"){

				          var id = $('.selected').attr('id');

                  if(id != undefined && id != ''){

        					  var thumb_url = $('.choose_image').attr('src');

        					  var thumb_media_id = $('.choose_image').attr('data-id');

        					  $('.hide_image,.get_image_show,.del_image').show();

        					  $('.get_image_show').attr('src',thumb_url);

        					  $('.uploadTs').hide();

        					  $('#'+id).find('.news_image').css({'background-image':'url('+'{$TencentPicturePre}'+thumb_url+')'});

        					  $('#'+id).find('.img_icon').hide();

        					  news[id]['thumb_url'] = thumb_url;

        					  news[id]['thumb_media_id'] = thumb_media_id;

                  }

			         }else if($('#edit_image').attr('data-edit') == 'Fromeditor'){

                  var thumb_url = $('.choose_image').attr('src');

                  var image = '<img src="'+thumb_url+'" style="max-width:640px;">';

                  um.execCommand('insertHtml',image);

                  $('#edit_image').attr('data-edit','');

               }

              });

              //图片删除按钮

              $('.hide_image').mouseover(function(){

                $('.news_del_image').show();

              });

              $('.hide_image').mouseout(function(){

                $('.news_del_image').hide();

              })



              //删除图片

              $('.news_del_image').children('a').click(function(){

                $('.hide_image,.get_image_show,.news_del_image').hide();

                $('.get_image_show').attr('src','');

                var id = $('.selected').attr('id');

                news[id]['thumb_url'] = '';

                news[id]['thumb_media_id'] = '';

                $('#'+id).find('.news_image').css({'background-image':'url("")'});

                $('#'+id).find('.img_icon').show();

                

              });



              //点击选中图文

              $('.add_news').on('click','.news_del',function(){

                var id = $(this).attr('id');

                //边框样式

                $('.news_del').removeClass('selected');

                $(this).addClass('selected');



                //清空样式

                $('.input_title').val(news[id]['title']);

                $('.input_author').val(news[id]['author']);

                $('.item_content').html(news[id]['content']);

                $('.summary').val(news[id]['digest']);

                $('.item_content').html('');

                $('.hide_image,.get_image_show,.del_image').hide();

                $('.get_image_show').attr('src','');

                $('.show_cover_pic').prop('checked',false);

                $('.text_link').val('');

                $('.text_link').hide();

                $('.select_link').prop('checked',false);



                if(news[id]['thumb_url'] != '' && news[id]['thumb_url'] != undefined){

                  $('.hide_image,.get_image_show,.del_image').show();

                  $('.get_image_show').attr('src',news[id]['thumb_url']);

                }else{

                  $('.hide_image,.get_image_show,.del_image').hide();

                  $('.get_image_show').attr('src','');

                }



                if(news[id]['show_cover_pic'] == 0){

                  $('.show_cover_pic').prop('checked',false);

                }else{

                  $('.show_cover_pic').prop('checked',true);

                }



                if(news[id]['url']!=undefined && news[id]['url']!=""){

                  $('.select_link').prop('checked',true);

                  $('.text_link').show();

                  $('.text_link').val(news[id]['url']);

                }else{

                  $('.select_link').prop('checked',false);

                  $('.text_link').hide();

                  $('.text_link').val('');

                }



                if(news[id]['content'] != '' && news[id]['content'] != undefined){

                   $('.item_content').html(news[id]['content']);

                }else{

                  $('.item_content').html('');

                }

                

              });



              //是否显示封面

              $('.show_cover_pic').click(function(){

               var id = $('.selected').attr('id');



                if($(this).prop('checked') == true){

                  news[id]['show_cover_pic'] = 1;

                }else{

                  news[id]['show_cover_pic'] = 0;

                }

               

              });



              //获取摘要

              $('.summary').blur(function(){

                var id = $('.selected').attr('id');

                if(id != undefined && id != ''){

                  news[id]['digest'] = $(this).val();

                }

              });



              //上传图文

              $('#uploadNews').click(function(){

                //检查图文消息是否完整

                for(var key in news){

                  if(news[key]){

                    if(news[key]['title'] == undefined || news[key]['title'] == ''){

                      $("#fq_alert_info").text("图文消息不完整1");

                      $('#fq_alert').modal();

                      return false;

                    }



                    if(news[key]['thumb_url'] == undefined || news[key]['thumb_url'] == ''){

                      $("#fq_alert_info").text("图文消息不完整2");

                      $('#fq_alert').modal();

                      return false;

                    }



                    if(news[key]['content'] == undefined || news[key]['content'] == ''){

                      $("#fq_alert_info").text("图文消息不完整3");

                      $('#fq_alert').modal();

                      return false;

                    }

                    

                  }

                }

				$('#uploadNews').attr("disabled",true);

                $('#uploadNews').html('<i class="am-icon-refresh am-icon-spin"></i> 上传中');



                $.ajax({

                  async:true,

                  dataType:'json',

                  type:'post',

                  data:{'news':news},

                  url:'index.php?m=Admin&c=Weixin&a=wxmaterialcreatenews',

                  success:function(data){

                    if(data.info == 1){

                      $("#fq_alert_info").text("上传成功");

                      $('#fq_alert').modal();

                      //window.opener.reloadBrowser();
					  window.location.href= 'index.php?m=Admin&c=Weixin&a=wxmaterial';

                    }else{

                      	$("#fq_alert_info").text("上传失败,错误代码"+data.err);

                      	$('#fq_alert').modal();

                    }

                    $('#uploadNews').attr("disabled",false);

                    $('#uploadNews').html('提交保存');

                  },

                  error:function(){

                    

                  }

                })

              });



				















            $('.image_table').on('click','.selected_image',function(){  

              $('.selected_image').removeClass('post_image');

              $(this).addClass('post_image');

              $('.selected_mask').css({'display':'none'});

              $(this).siblings('.selected_mask').css({'display':'block'});



            });

          });

		  //正文图片选择

		  $('.imagetest').click(function(){

			$('#').modal();
			//um.setContent('<p>new text</p>', true);

		  

		  }); 

                  

</script>

<style type="text/css">	
.appmsg_content {
	position:relative;
	width:320px;
	border: 1px solid #e7e7eb;
}
.appmsg_info {
	font-size:13px;
	line-height:20px;
	padding:12px 14px 0;
}
.appmsg_item {
	position:relative;
	padding:12px 14px;
}
.appmsg_date {
	font-weight:400;
	font-style:normal;
}
.appmsg_title {
	margin:0;
	font-weight:400;
	font-style:normal;
	font-size:14px;
	line-height:28px;
	max-height:56px;
	overflow:hidden;
	word-wrap:break-word;
	word-break:break-all;
	color:#222;
	text-align:left;
}
.appmsg_thumb_wrp {
	height:160px;
	overflow:hidden;
	background-repeat: no-repeat;
	background-position:center center;
	background-size:cover;
}
.appmsg_desc {
	padding:5px 0 10px;
	margin:0;
	word-wrap:break-word;
	word-break:break-all;
}
.appmsg_content .cover_appmsg_item {
	position:relative;
	margin:22px 14px;
}
.cover_appmsg_item .appmsg_title {
	font-size:14px;
	position:absolute;
	bottom:0;
	left:0;
	right:0;
	background:rgba(0,0,0,0.6)!important;
}
.cover_appmsg_item .appmsg_title a {
	color:#fff;
}
.has_cover {
	height:102px;
	border-top:1px solid #e7e7eb;
}
.has_cover .appmsg_thumb_wrp {
	float:right;
	width:78px;
	height:78px;
	margin-left:14px;
	margin:0;
}
.has_cover .appmsg_title {
	display:inline-block;
	width:200px;
	line-height:24px;
	max-height:48px;
	overflow: hidden;
	margin-top:14px;
}
.appmsg_title a {
	display:block;
	padding:0 8px;
	color:#222;
}
.newsbox {
	width:30%;
	height:100%;
	float:left;
	margin:0 15px;
}
.newsbox .appmsg_content {
	width:100%	}
.newsbox .appmsg_title a {
	text-align:left;
}
.newsbox .has_cover .appmsg_title {
	width:180px;
}
.newsbox .appmsg_info {
	text-align: left;
}
.newsbox .appmsg_desc {
	text-align: left;
}
.newsDesc {
	position:relative;
	margin-bottom:20px;
}
.chooseNew {
	position:absolute;
	top:0;
	left:0;
	right:0;
	bottom:0;
	background-color:rgba(0,0,0,0.6);
	z-index:999;
	display:none;
}
.news_table {
	padding:15px 10px;
	height:80%;
	overflow:hidden;
	margin:0;
}
.news_content_box .mT {
	margin-top:25%;
}
.loading {
	display:block;
}
.news_content_box {
	border:1px solid #e7e7eb;
	padding:15px 0;
}
.choose_icon {
	background: transparent url(__STATIC__/weixin/assets/sell/images/selected_mask_icon.png) no-repeat 0 0;
	width: 45px;
	height: 38px;
	position:absolute;
	top:45%;
	left:43%;
}
<!--删除修改样式开始-->	.grid_item.no_extra {
	float: none;
	width: auto;
	overflow: hidden;
}
.appmsg_opr_item {
	line-height: 44px;
	height: 44px;
	width:148px;
}
.newsbox ul {
	border-bottom: 1px solid #e7e7eb;
	border-right: 1px solid #e7e7eb;
	border-left: 1px solid #e7e7eb;
	padding-left: 0px;
	background:#e7e7eb;
	margin-bottom:20px;
	position: relative;
}
.newsbox li {
	float:left;
}
.right_del:hover {
	color:#000;
}
.li_left {
	border-right:0.5px solid #ccc;
	cursor:pointer;
}
.li_right {
	cursor:pointer;
}
<!--警告框样式开始-->	.popover {
	width: 290px;
}
.del_confirm .popover {
	display:none;
	position: absolute;
	margin-top: 12px;
	z-index:2001;
}
.del_confirm .popover .popover_inner {
	border: 1px solid #d9dadc;
	word-wrap: break-word;
	word-break: break-all;
	padding: 30px;
	background-color: #fff;
	-webkit-box-shadow: none;
	width:216px;
	height:136px;
}
.tl {
	text-align: left;
}
.del_confirm .popover_content p {
	display: block;
	-webkit-margin-before: 1em;
	-webkit-margin-after: 1em;
	-webkit-margin-start: 0px;
	-webkit-margin-end: 0px;
	margin: 0;
}
.popover .popover_bar {
	text-align: justify;
	text-justify: distribute-all-lines;
	font-size: 0;
	width:100%;
}
.popover .popover_bar .btn {
	/*margin-top: 18px;*/
	
}
.btn {
	min-width: 60px;
	display: inline-block;
	overflow: visible;
	padding: 0 22px;
	height: 30px;
	line-height: 30px;
	vertical-align: middle;
	text-align: center;
	text-decoration: none;
	border-radius: 3px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	font-size: 14px;
	border-width: 1px;
	border-style: solid;
	cursor: pointer;
	margin-left:12px;
}
.btn_primary {
	background-color: #44b549;
	background-image: -moz-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: -webkit-gradient(linear,0 0,0 100%,from(#44b549),to(#44b549));
	background-image: -webkit-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: -o-linear-gradient(top,#44b549 0,#44b549 100%);
	background-image: linear-gradient(to bottom,#44b549 0,#44b549 100%);
	border-color: #44b549;
	color: #fff;
	margin-top:18px;
	margin-left:0px;
}
.popover_bar a {
	outline: 0;
}
.btn_primary:hover {
	color:fff;
}
.btn_default:hover {
	background-color: #e7e7eb;
	background-image: -moz-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: -webkit-gradient(linear,0 0,0 100%,from(#e7e7eb),to(#e7e7eb));
	background-image: -webkit-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: -o-linear-gradient(top,#e7e7eb 0,#e7e7eb 100%);
	background-image: linear-gradient(to bottom,#e7e7eb 0,#e7e7eb 100%);
	border-color: #dadbe0;
	box-shadow: none;
	-moz-box-shadow: none;
	-webkit-box-shadow: none;
	color: #000;
	!important
}
.btn_default {
	margin-top:18px;
	margin-right:-10px;
	border:#e7e7eb solid 1px;
	color:#000;
}
.btn:hover {
	text-decoration: none;
}
.t1 {
	font-size:14px;
}
.del_confirm .popover .popover_arrow_out {
	top: 0;
}
.del_confirm .popover .popover_arrow {
	position: absolute;
	left: 50%;
	margin-left: -8px;
	margin-top: -8px;
	display: inline-block;
	width: 0;
	height: 0;
	border-width: 8px;
	border-style: dashed;
	border-color: transparent;
	border-top-width: 0;
	border-bottom-color: #d9dadc;
	border-bottom-style: solid;
}
.del_confirm .popover .popover_arrow_in {
	border-bottom-color: #fff;
	top: 1px;
}
.edit_confirm .speech-bubble {
	display:none;
	position: absolute;
	background-color: #666;
	margin-left: auto;
	margin-right: auto;
	width: 35px;
	height: 27px;
	line-height: 27px;
	/* 垂直居中*/
	color: white;
	text-align: center;
	/*border-radius: 10px;
	font-family: sans-serif;*/
	bottom:55px;
	left:55px;
}
.edit_confirm p {
	font-size:12px;
}
.edit_confirm .speech-bubble:after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 5px solid;
}
.edit_confirm .speech-bubble-bottom:after {
	border-top-color: #666;
	top: 100%;
	left: 74%;
	margin-left: -15px;
}
.del_confirm .speech-bubble {
	display:none;
	position: absolute;
	background-color: #666;
	margin-left: auto;
	margin-right: auto;
	width: 35px;
	height: 27px;
	line-height: 27px;
	/* 垂直居中*/
	color: white;
	text-align: center;
	/*border-radius: 10px;
	font-family: sans-serif;*/
	bottom:55px;
	right:51px;
}
.del_confirm p {
	font-size:12px;
}
.del_confirm .speech-bubble:after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 5px solid;
}
.del_confirm .speech-bubble-bottom:after {
	border-top-color: #666;
	top: 100%;
	left: 74%;
	margin-left: -15px;
}
<!--警告框样式结束-->	<!--介绍-->
</style>

<link rel="stylesheet" type="text/css" href="__STATIC__/weixin/assets/sell/css/wxkeyword.css" />
<!--回复图文项 start-->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-news" data-id="3">
		<div class="am-modal-dialog">
		   	<div class="am-modal-hd modal-hd-top">
		   		选择图文素材
		        <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
		    </div>
		    <div class="am-cf">
				<button type="button" style="background:#5eb95e;border-color:#5eb95e;border-radius:3px;" class="am-margin-sm am-fl am-btn am-btn-secondary type_news getMaterial">重新获取图文</button>
				<button type="submit" class="am-fl am-btn am-margin-sm am-btn-secondary" id="material_up" style="display:none;margin-left:0px;background:#5eb95e;border-color:#5eb95e; border-radius:3px;" disabled data-start="">上一页</button>
				<button type="submit" class="am-fl am-margin-sm am-btn am-btn-secondary" style="margin-left:0px;background:#5eb95e;border-color:#5eb95e;border-radius:3px;display:none;"  id="material_down" data-start="">下一页
				</button>
				<button type="button" class="am-btn am-btn-secondary" style="float:right;margin-right:21px;margin-top:10px;"><a href="index.php?m=Admin&c=Weixin&a=wxmaterialcreatenews" style="color:#fff;">+ 新建图文消息</a></button>
		    </div>
		    <div class="news_table">
		    	<div class="news_content_box" style="width:100%;height:100%;overflow:overlay;">
		    		<div class="loading mT">
		    			<i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候
		    		</div>
		    	</div>
		    </div>
		    <button type="submit" class="am-btn am-btn-secondary am-disabled" data-am-modal-close="" data-id="" id="edit_news" data-src="" data-title="" data-edit="0">确认选择</button>
		    <button type="reset" class="am-btn am-btn-secondary" style="width:98px;" data-am-modal-close="" class="modal-close">取&nbsp;&nbsp;消</button>
		</div>
	</div>
	<!--回复图文项 end-->
	
	
	<!--回复图片项 star-->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-image" data-id="2">
    
		<div class="am-modal-dialog">
		   	<div class="am-modal-hd modal-hd-top">选择图片
		        <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
		    </div>
		    <div class="image_table">
		    	<form method="post" enctype="multipart/form-data" name="form_image" id="image_upload" action="index.php?m=Admin&c=Weixin&a=localimage" style="display:none;" >
						<input type="file" name="upload_image" value="" class="addimage" style="opacity:0" id="upload_image"  accept="image/*" multiple="multiple"/>
					</form>
		    	<div class="file_local"> 
					<button type="button" id="image_agin" class="image_model am-fl am-btn am-btn-secondary" style="margin-left:10px;border-radius:3px;background:#5eb95e;border-color:#5eb95e;" >重新获取图片</button>
					<button id="last_image" type="button" class=" am-fl am-btn am-btn-secondary" disabled style="margin-left:10px;background:#5eb95e;border-color:#5eb95e;display:none;border-radius:3px;" data-start="" />上一页
					</button>
					<button id="next_image" type="button" class="am-fl am-btn am-btn-secondary" style="display:none;margin-left:10px;background:#5eb95e;border-color:#5eb95e;border-radius:3px;" data-start="" />下一页
					</button>
		    		<button type="button" class="am-btn am-btn-secondary file_image" style="float:right;margin-right:10px;" >本地上传</button>
		    	</div>
		    	<div class="image_list" style="margin-top:32px;"><i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i></div>
				<div class="ima_showbutton">
					
				</div>
		    </div>
		    <button type="submit" class="am-btn am-btn-secondary am-disabled" data-am-modal-close="" id="edit_image" data-id="" data-edit="0">确认选择</button>
		    <button type="reset" class="am-btn am-btn-secondary" style="width:98px;" data-am-modal-close="" class="modal-close">取&nbsp;&nbsp;消</button>
		</div>
        
	</div>
	<!--回复图片项 end-->
	
	<script>
		$(function(){
			//选择图文
			$('.news_content_box').on('mouseover','.newsDesc',function(){
				$('.chooseNew').hide();
				$('.choose').siblings('.chooseNew').show();
				$(this).children('.appmsg_content').css('border','1px solid #5eb95e');
				$('.choose').css('border','1px solid #e7e7eb');
			});
			$('.news_content_box').on('mouseout','.newsDesc',function(){
				$('.chooseNew').hide();
				$('.choose').siblings('.chooseNew').show();
				$('.newsDesc .appmsg_content').css('border','1px solid #e7e7eb');
			})

			$('.news_content_box').on('click','.newsDesc',function(){
				$('.newsbox .appmsg_content').removeClass('chooseicon');
				$('.newsbox .appmsg_content').removeClass('choose');
				$('.chooseNew').hide();
				$(this).children('.chooseNew').show();
				$(this).children('.chooseNew').html('<div class="choose_icon"></div>');
				$(this).children('.appmsg_content').addClass('choose');
				$('#edit_news').removeClass('am-disabled');
			});

			$('.getMaterial').click(function(){
				$('.newsbox').remove();
				$('.news_content_box').html('<div class="loading mT"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
			});
			//图文列表
			$('.type_news').click(function(){
				
				var news_content_length= $('.news_content_box').html().length;
				$('.type_news').ajaxSubmit({
					data:{"type":3},
					type:'post',
					url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
					beforeSubmit:function(){
						if(news_content_length>129){
							return false;
						};
					},
					success:function(data){
						var $newsList = data.list;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						$('#material_up').attr('data-start',0);
						$('#material_down').attr('data-start',10);
						$('#material_up').attr('disabled',true);
						$('#material_down').attr('disabled',false);
						if($newsList.length<data.count){
							$('#material_up').css('display','block');
							$('#material_down').css('display','block');
						}else{
							$('#material_up').css('display','none');
							$('#material_down').css('display','none');
						}
						
					}
				});
			});
			
			//重新获取图片
			$('#image_agin').click(function(){
			
				$('.show_image').remove();
				$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
			
			})
			
			//图片模态框显示
			$('.image_model').click(function(){
			$('.image_model').ajaxSubmit({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				//data:{'start':$('#next_image').attr('data-start')},
				beforeSubmit:function(){
					if($('.image_list').html().length>80){
								return false;
							}
				},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($image_array.length<data.count){
						$('#next_image').css('display','block');
						$('#last_image').css('display','block');
					}else{
						$('#next_image').css('display','none');
						$('#last_image').css('display','none');
					}
				},
				error:function(){
					console.log("失败");
				}
			});
			$('#next_image').attr('data-start',20);
			$('#last_image').attr('data-start',0);
	})
	
	
		});
//下一页图片
$("#next_image").click(function(){
		$('.show_image').remove();
		$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
		$.ajax({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				data:{'start':$('#next_image').attr('data-start')},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($image_array!=''){
						var next_image = parseInt($('#next_image').attr('data-start'));
						var next_image_start = next_image+20;
						$('#next_image').attr('data-start',next_image_start);
						var last_image = parseInt($('#last_image').attr('data-start'));
						var last_image_start =	next_image-20;
						$('#last_image').attr('data-start',last_image_start);
						$('#last_image').attr('disabled',false);
					}else{
						$('.image_list').html('<div style="margin-top:255px;">没有了</div>');
						$('#next_image').attr('disabled',true);
						var rest_last_image = parseInt($('#last_image').attr('data-start'))+20;
						$('#last_image').attr('data-start',rest_last_image);
					}
				},
			});
})
//上一页图片
$("#last_image").click(function(){
	$('.show_image').remove();
		$('.image_list').html('<i class="am-icon-refresh am-icon-spin am-icon-sm" style="margin-top:255px"></i>');
		$.ajax({
				url:"index.php?m=Admin&c=Weixin&a=wxgetimagejson",
				type:'get',
				data:{'start':$('#last_image').attr('data-start')},
				success:function(data){
					var $image_array = data.item; 
					var image_show = "";
					for(var i =0;i< $image_array.length;i++){
						image_show +='<div class="show_image"><div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="{$TencentPicturePre}'+$image_array[i]['url']+'" alt="" data-id ="'+$image_array[i]['media_id']+'" class="selected_image"></div>';
					}
					$('.image_list').html(image_show);
					if($("#next_image").attr('disabled')){
						var a = parseInt($("#next_image").attr('data-start'))+20;
						$("#next_image").attr('data-start',a);
						//var b =	parseInt($("#last_image").attr('data-start'))+20;
						//$("#last_image").attr('data-start',b);
					}
					var last_image = parseInt($('#last_image').attr('data-start'));
					var last_image_start = last_image-20;
					$('#last_image').attr('data-start',last_image_start);
					var next_image = parseInt($('#next_image').attr('data-start'));
					var next_image_start = next_image-20;
					$('#next_image').attr('data-start',next_image_start);
					$('#next_image').attr('disabled',false);
					if($('#last_image').attr('data-start')<0){
						$('#last_image').attr('disabled',true);
					}
				},
			});
})


//上传图片
$('.file_image').click(function(){
	$('.addimage').click();
});
$('#upload_image').change(
	function(){
	$('.image_table .show_image').eq(0).before('<div class="show_image"><span class="text_center"><i class="am-icon-refresh am-icon-spin"></i> 上传中</span></div>');
			if($('.image_table .show_image').length>=20){
				$('.image_table .show_image:last-child').remove();
			}
			$('#edit_image').attr('disabled',true);
			$('.file_image').attr('disabled',true);
			$('.file_image').html('<i class="am-icon-spinner am-icon-spin"></i> 上传中');
			$('#image_upload').ajaxSubmit({
				dataType:'json',
				success:function(data){
					if(data.info == 1){
						$('#edit_image').attr('disabled',false);
						$('.file_image').attr('disabled',false);
						$('.file_image').html('本地上传');
						
					$('.image_table .show_image').eq(0).html('<div class="selected_mask"><div class="selected_mask_inner"></div><div class="selected_mask_icon"></div></div><img src="'+'{$TencentPicturePre}'+data.image_url+'" alt="" class="selected_image">');
					}
				}
			});
		}
	
	);

//下一页图文
$('#material_down').click(function(){
	$('.newsbox').remove();
	$('.news_content_box').html('<div class="loading mT" style="display:block;"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
	var start = $(this).attr('data-start');
	var end   = $(this).attr('data-num');
	$.ajax({
	
		data:{"type":3,"start":start,"end":end},
		type:'post',
		url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
		success:function(data){
			if(data.info == 1){
				var $newsList = data.list;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						if(data.list!=''){
											var material_down_start = parseInt($('#material_down').attr('data-start'));
											var material_up_reststart = material_down_start-10;
											$('#material_up').attr('data-start',material_up_reststart);
											var material_down_reststart = material_down_start+10;
											$('#material_down').attr('data-start',material_down_reststart);
											$('#material_up').attr("disabled",false);
										}else{
												$('.news_content_box').html('<div class="loading mT" style="display:block;">没有了...</div>');
												var rest_upstart= parseInt($('#material_up').attr('data-start'))+10;
												$('#material_up').attr('data-start',rest_upstart);
												$('#material_down').attr("disabled",true);
												$('#material_up').attr("disabled",false);
										}
			}
		}
	})
});

//上一页图文
$('#material_up').click(function(){
	$('.newsbox').remove();
	$('.news_content_box').html('<div class="loading mT" style="display:block;"><i class="am-icon-refresh am-icon-spin am-icon-md"></i> 获取中,请稍候</div>');
	var start = $(this).attr('data-start');
	var end   = $(this).attr('data-num');
	$.ajax({
		data:{"type":3,"start":start,"end":end},
		type:'post',
		url:'index.php?m=Admin&c=Weixin&a=wxmaterialgetnewsjson',
		success:function(data){
			if(data.info == 1){
				var $newsList = data.list;
						var content = '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 0){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover" id=""><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 1){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item"><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						content += '<div class="newsbox">';
						for(var i=0;i<$newsList.length;i++){
							if(i%3 == 2){
								content +='<div class="newsDesc" id="'+$newsList[i]['media_id']+'"><div class="chooseNew"></div><div class="appmsg_content" data-id="'+$newsList[i]['media_id']+'"><div class="appmsg_info"><em class="appmsg_date"></em></div>';
								for(var j=0;j<$newsList[i]['content']['news_item'].length;j++){
									if($newsList[i]['content']['news_item'].length == 1){
										content += '<div class="appmsg_item '+$newsList[i]['media_id']+'" id=""><h4 class="appmsg_title js_title">'+$newsList[i]['content']['news_item'][j]['title']+'</h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div><p class="appmsg_desc">'+$newsList[i]['content']['news_item'][j]['digest']+'</p></div>';
									}else{
										if(j == 0){
											content += '<div class="cover_appmsg_item"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}else{
											content += '<div class="appmsg_item has_cover"><h4 class="appmsg_title js_title"><a href="javascript:void(0);">'+$newsList[i]['content']['news_item'][j]['title']+'</a></h4><div class="appmsg_thumb_wrp" style="background-image:url('+'{$TencentPicturePre}'+$newsList[i]['content']['news_item'][j]['thumb_url']+')"></div></div>';
										}
									}
								}
								content += '</div></div>';
							}
						}
						content += '</div>';
						$('.news_content_box').html(content);
						if($('#material_down').attr('disabled')){
							var down_start =  parseInt($('#material_down').attr('data-start'))+10;
							$('#material_down').attr('data-start',down_start);
						}
						$('#material_down').attr('disabled',false);
						var par_start =  parseInt($('#material_up').attr('data-start'))-10;
						$('#material_up').attr('data-start',par_start);
						var down_start = parseInt($('#material_down').attr('data-start'))-10;
						$('#material_down').attr('data-start',down_start);
						if($('#material_up').attr('data-start')<0){
							$('#material_up').attr('disabled',true);
						}
			}
		}
	})
});


//选择图片素材
$('.image_table').on('click','.selected_image',function(){	
	var image_id = $(this).attr('data-id');
	$('#edit_image').attr('data-id',image_id);
	$('.selected_mask').css({'display':'none'});
	$(this).siblings('.selected_mask').css({'display':'block'});
	$(".selected_image").removeClass("choose_image");
	$(this).addClass("choose_image");
	if(image_id!=''){
		$('#edit_image').removeClass('am-disabled');
	}else{
		$('#edit_image').addClass('am-disabled');
	}

});


$('#edit_image').click(function(){
	$('#edit_image').addClass('am-disabled');
	$('.selected_mask').hide();
});
		
</script>

<div class="am-modal am-modal-confirm" tabindex="-1" id="delNews">

  <div class="am-modal-dialog">

    <div class="am-modal-hd">爱淘客</div>

    <div class="am-modal-bd">

      您确定要删除这条图文吗？

    </div>

    <div class="am-modal-footer">

      <span class="am-modal-btn" data-am-modal-confirm>确定</span>

      <span class="am-modal-btn" data-am-modal-cancel>取消</span>

    </div>

  </div>

</div>